package com.tlgen.runner;

import com.tlgen.service.ConfigService;
import com.tlgen.service.HeartBeatService;
import com.tlgen.service.RegistryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class StartupApplicationRunner implements ApplicationRunner {

    @Autowired
    private ConfigService configService;

    @Autowired
    private RegistryService registryService;

    @Autowired
    private HeartBeatService heartBeatService;

    @Override
    public void run(ApplicationArguments args) {
        // 拉取全量配置
        configService.pullAllInstance();
        // 拉取全量服务列表
        registryService.pullAllInstance();
        // 接收心跳信息
        heartBeatService.receive();
    }

}
